package com.snowcattle.game.db.sharding;

import org.springframework.stereotype.Service;

/**
 *
 */
@Service
public class CustomerContextHolder {

    private static final ThreadLocal<String> contextHolder = new ThreadLocal<>();

    public static String getCustomerType() {
        return contextHolder.get();
    }

    /**
     * 通过字符串选择数据源
     *
     * @param customerType
     */
    public static void setCustomerType(String customerType) {
        contextHolder.set(customerType);
    }

}
